home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Auge 4000 / Auge 4000 #64 (1992-08-13)(Amiga User Gruppe Einzugsgebiet 4000).zip / Auge 4000 #64 (1992-08-13)(Amiga User Gruppe Einzugsgebiet 4000).adf / TKEd / rexx / Count-Words.tked < prev    next >
Text File  |  1992-06-12  |  1KB  |  31 lines

  1. /**
  2.  ** ARexx program to count the number of words in a file 
  3.  **  
  4.  ** © Tom Kroener '92
  5.  **
  6.  **/
  7.  
  8. options results
  9. address 'TKEd.1'                /* Portname of the first started TKEd */
  10. LF = '0A'X                      /* 'Linefeed' */
  11.  
  12. BeginOfFile                     /* Go to start */
  13. LastLine                        /* Get number of the last line */
  14. LastLineNr = result
  15.  
  16. Words = 0                       /* Counter for the words */
  17. LineNr = 1                      /* Counter for the lines */
  18. DO WHILE LineNr <= LastLineNr   /* Counts until it reaches the last line */
  19.   GetLine                       /* Returns the current line of the text */
  20.   Words = Words + WORDS(result) /* Add the number of words of this line */
  21.   Cursor "DOWN"                 /* Goto next line */
  22.   LineNr = LineNr + 1           /* Increment linecounter */
  23. END
  24. LineNr = LineNr - 1
  25. Request1 "TKED""Counted" Words "Words in" LineNr "Lines"
  26.                                 /* Brings up a requester with a message */
  27.                                 /* "TKED" forces the requester to 
  28.                                     appear on TKEd's screen */
  29. EXIT 0
  30.  
  31.